//
//  WFGuiBiewController.m
//  谷居
//
//  Created by dllo on 16/7/4.
//  Copyright © 2016年 刘万方. All rights reserved.
//

#import "WFGuiBiewController.h"
#import "Masonry.h"
#import "WFTabBarViewController.h"
@interface WFGuiBiewController ()
@property (nonatomic, retain) UIScrollView *guideScrollView;
@end

@implementation WFGuiBiewController

- (void)viewDidLoad {
    [super viewDidLoad];
    self.view.backgroundColor = [UIColor redColor];
    [self createScrollView];
    // Do any additional setup after loading the view.
}
- (void)createScrollView {
    _guideScrollView = [[UIScrollView alloc] initWithFrame:[[UIScreen mainScreen]bounds]];
    [self.view addSubview:_guideScrollView];
    [_guideScrollView release];
    
    _guideScrollView.contentSize = CGSizeMake(SCREEN_WIDTH * 4, 0);
    _guideScrollView.pagingEnabled = YES;
//    _guideScrollView.showsVerticalScrollIndicator = NO;
//    _guideScrollView.showsHorizontalScrollIndicator = NO;
    _guideScrollView.backgroundColor = [UIColor greenColor];
    for (int i = 0; i < 4; i++) {
        UIImageView *imageView = [[UIImageView alloc] initWithFrame:CGRectMake(SCREEN_WIDTH * i, 0, SCREEN_WIDTH, SCREEN_HEIGHT)];
        [_guideScrollView addSubview:imageView];
        imageView.image = [UIImage imageNamed:[NSString stringWithFormat:@"960_%d.png", i + 1]];
        [imageView release];
        imageView.userInteractionEnabled = YES;
        
        if (i == 3) {
            NSLog(@"创建button");
            UIButton *button = [UIButton buttonWithType:UIButtonTypeCustom];
            button.frame = CGRectMake(140, 480, 60, 20);
            [imageView addSubview:button];
//            [button mas_makeConstraints:^(MASConstraintMaker *make) {
//                
//                make.centerX.equalTo(self.view);
//                make.centerY.mas_equalTo(@400);
//                make.size.mas_equalTo(CGSizeMake(100, 20));
//                
//            }];
//            [button setBackgroundColor:[UIColor blackColor]];
            [button setTitle:@"进入" forState:UIControlStateNormal];
            [button setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];
            [button addTarget:self action:@selector(modal:) forControlEvents:UIControlEventTouchUpInside];
        }
        
    }
}

- (void)modal:(UIButton *)button {
    NSLog(@"button被点击");
    WFTabBarViewController *tab = [[WFTabBarViewController alloc] init];
    
    [self presentViewController:tab animated:YES completion:^{
        
        
    }];
    [tab release];
    
}
- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
